{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ***Introduction to Radar Using Python and MATLAB***\n",
    "## Andy Harrison - Copyright (C) 2019 Artech House\n",
    "<br/>\n",
    "\n",
    "# Analog to Digital Resolution\n",
    "***"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For an ideal ADC, the signal to noise ratio (dB) may be expressed as (Equation 5.21)\n",
    "\n",
    "$$\n",
    "{SNR} \\approx 6.02 N + 1.76 \\hspace{0.5in} \\text{(dB)}\n",
    "$$\n",
    "\n",
    "Since the SNR of practical ADCs never reach this ideal value due to noise and distortion, the SNR may be related to that of an ideal ADC with fewer bits.  This effective number of bits may be written according to (Equation 5.22)\n",
    "\n",
    "$$\n",
    "N_{{eff}} = \\frac{{SNR} - 1.76}{6.02}\n",
    "$$\n",
    "***"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Set the number of bits and signal to noise ratio for the analog to digital converter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "number_of_bits = 12\n",
    "\n",
    "signal_to_noise = 63"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Display the results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ideal signal to noise ratio (dB) 74.00\n",
      "Effective number of bits 10.17\n"
     ]
    }
   ],
   "source": [
    "print('Ideal signal to noise ratio (dB) {:.2f}'.format(6.02 * number_of_bits + 1.76))\n",
    "\n",
    "print('Effective number of bits {:.2f}'.format((signal_to_noise - 1.76) / 6.02))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
